<!DOCTYPE html>
<html>
    <head lang="en">
        <meta charset="UTF-8">
        <script>
            var ta;
            var btn;
            window.onload=function(){
                ta =document.getElementById("ta");
                if (localStorage.text){
                    ta.value=localStorage.text;
                }
                btn =document.getElementById("btn");
                btn =onclick=function(){
                    alert(ta.value);
                    localStorage.text=ta.value;
                }
            }
        </script>
    </head>
    <body>
        <textarea  id="ta" style="width: 200px;height:200px"></textarea>
        <button id="btn">sabe</button>
        
    </body>
</html>